package com.chen.recruit.domain;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.chen.recruit.common.constants.SysConstants;
import com.chen.recruit.common.enums.CommonStatus;
import com.chen.recruit.common.enums.SexEnum;
import com.chen.recruit.common.enums.UserType;
import com.chen.recruit.common.valid.AddGroup;
import com.chen.recruit.common.valid.UpdateGroup;
import com.chen.recruit.domain.model.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.*;
import java.util.List;

/**
 * 学生领域对象
 *
 * @author cgy
 * @date 2022/10/14
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel("Student 学生领域对象")
public class Student extends BaseEntity {

    @ApiModelProperty("学生id")
    @Null(message = "新增学生id必须为空", groups = AddGroup.class)
    @NotNull(message = "更新学生id不能为空", groups = UpdateGroup.class)
    private Integer id;

    @ApiModelProperty("院系id")
    @NotNull(message = "所属院系不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private Integer collegeId;

    @ApiModelProperty("学号")
    @Excel(name = "学号", width = 20)
    @NotBlank(message = "学号不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String username;

    @ApiModelProperty("密码")
    @Excel(name = "密码", width = 20)
    @NotBlank(message = "密码不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String password;

    @ApiModelProperty("姓名")
    @Excel(name = "姓名", width = 20)
    @NotBlank(message = "姓名不能为空", groups = {AddGroup.class, UpdateGroup.class})
    private String name;

    @ApiModelProperty("邮箱")
    @Excel(name = "邮箱", width = 20)
    @Email(message = "邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
    private String email;

    @ApiModelProperty("手机号")
    @Excel(name = "手机号", width = 20)
    private String phoneNumber;

    @ApiModelProperty("性别")
    @Excel(name = "性别", width = 20, enumImportMethod = SysConstants.ENUM_IMPORT_FIELD, enumExportField = SysConstants.ENUM_EXPORT_FIELD)
    private SexEnum sex;

    @ApiModelProperty("用户头像")
    private String avatar;

    @ApiModelProperty("备注")
    @Excel(name = "备注", width = 20)
    private String remark;

    @ApiModelProperty("用户类型(0管理员 1企业 2学生)")
    private UserType type;

    @ApiModelProperty("状态（0停用 1正常）")
    @NotNull(message = "状态不能为空", groups = UpdateGroup.class)
    @Excel(name = "状态", width = 20, enumImportMethod = SysConstants.ENUM_IMPORT_FIELD, enumExportField = SysConstants.ENUM_EXPORT_FIELD)
    private CommonStatus status;

    @ApiModelProperty("角色id集合")
    private List<Integer> roleIds;

    @ApiModelProperty("院系")
    @Excel(name = "院系", width = 20)
    private String collegeName;

    @ApiModelProperty("角色")
    @Excel(name = "角色", width = 20)
    private String roleName;

}
